import { createApp } from 'vue';
import MiAlert from './MiAlert.vue'

export default function (options:{
    text?:string;
    title?:string;
}) {
    const divEle = document.createElement('div')
    document.body.appendChild(divEle)
    let app: any = null;
    return new Promise((resolve) => {
        app = createApp(MiAlert, { ...options, resolve });
        app.mount(divEle)
    })
        .then(() => {
            app.unmount()
            document.body.removeChild(divEle)
        })
        .catch(() => {
            return Promise.reject()
        })
}